<template>
  <div class="tabbar">
    <div :class="{item:true,active:clickText == index}" v-for="(item, index) in list" :key="index" @click="handleClick(index)">
      {{ item.name }}
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      clickText: 0,
      list: [
        { id: 1, name: "首页" },
        { id: 2, name: "订单" },
        { id: 3, name: "我的" },
      ],
    };
  },
  methods: {
    handleClick(index) {
      this.clickText = index;
    },
  },
};
</script>

<style scoped>
.tabbar {
  height: 50px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 2px solid gainsboro;
  /* background-color: red; */
}
.item {
  cursor: pointer;
}
.active {
  color: rgb(0, 157, 255);
}
</style>